#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <iostream>
#include <fstream>
#include <string>
#include <QFontDatabase>
#include <QCursor>
#include <QFont>
#include "interface/InterFace.h"
#include "comm/log.h"

int main(int argc, char *argv[])
{
    LOG(DEBUG, "Hello World");
    LOG(DEBUG, "for test");
    QGuiApplication app(argc, argv);
    
    //app.setFont(QFont(":/ttf/NotoSansCJKsc-Bold.otf"));
    QQmlApplicationEngine engine;
    QObject::connect(
        &engine,
        &QQmlApplicationEngine::objectCreationFailed,
        &app,
        []()
        { QCoreApplication::exit(-1); },
        Qt::QueuedConnection);

    engine.rootContext()->setContextProperty("ui", InterFace::GetInstance());
    engine.loadFromModule("RPIUI", "Main");
    //int font_id = QFontDatabase::addApplicationFont(":/ttf/NotoSansCJKsc-Bold.otf");
    // if (font_id == -1)
    // {
    //     LOG(FATAL, "Failed to load font!");
    // }
    app.setOverrideCursor(QCursor(Qt::BlankCursor));
    return app.exec();
}
